﻿// -----------------------------------------------------------------------
// <copyright file="_CreateView.cs" company="Microsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace ConsoleApplication1.YIBIYIMVC
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using DotNet.Schema;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public partial class IService
    {
        public string NameSpacePR;
        public TableInfo DBTable;

        public IService(TableInfo t, string ns)
        {
            if (t == null)
                throw new Exception("参数t，不能为null。");

            this.NameSpacePR = ns;
            this.DBTable = t;
        }

        public string GetKeyParamterString()
        {
            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < this.DBTable.Keys.Count; i++)
            {
                if (i > 0)
                {
                    sb.Append(", ");
                }
                var item = this.DBTable.Keys[i];
                sb.AppendFormat("{0} {1}", item.CSharpType, item.PascalName);
            }
            return sb.ToString();
        }
    }
}
